home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Sparks.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-11-16  |  23.1 KB  |  503 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import B3DLib
  6. import Reference
  7. import netgame
  8. import Damage
  9. import Water
  10. import whrandom
  11. import Breakings
  12. import Blood
  13.  
  14. def ThrowSparks(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, wcx, wcy, wcz, wdx, wdy, wdz):
  15.     obj = Bladex.GetEntity(hitting_entity)
  16.     
  17.     try:
  18.         if obj and obj.Data.NoFXOnHit:
  19.             return None
  20.     except:
  21.         pass
  22.  
  23.     mod = B3DLib.Modulo(ximpulse, yimpulse, zimpulse)
  24.     if mod < 5000.0:
  25.         return None
  26.     
  27.     sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  28.     chispa = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  29.  
  30.  
  31. def ThrowMetalSparks(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, wcx, wcy, wcz, wdx, wdy, wdz):
  32.     obj = Bladex.GetEntity(hitting_entity)
  33.     
  34.     try:
  35.         if obj and obj.Data.NoFXOnHit:
  36.             return None
  37.     except:
  38.         pass
  39.  
  40.     mod = B3DLib.Modulo(ximpulse, yimpulse, zimpulse)
  41.     if mod < 5000.0:
  42.         return None
  43.     
  44.     sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  45.     chispa = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  46.     on_hit_info = Reference.MaterialOnHitInfo['Metal']
  47.     sound = on_hit_info[0]
  48.     if sound:
  49.         sound.Stop()
  50.         sound.Play(xhit_point, yhit_point, zhit_point, 0)
  51.     
  52.  
  53.  
  54. def ThrowDustAndSparks(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, wcx, wcy, wcz, wdx, wdy, wdz):
  55.     obj = Bladex.GetEntity(hitting_entity)
  56.     
  57.     try:
  58.         if obj and obj.Data.NoFXOnHit:
  59.             return None
  60.     except:
  61.         pass
  62.  
  63.     mod = B3DLib.Modulo(ximpulse, yimpulse, zimpulse)
  64.     if mod < 5000.0:
  65.         return None
  66.     
  67.     sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  68.     chispa = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  69.     polvillo = Bladex.CreateEntity('PolvoGolpe', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  70.     polvillo.ParticleType = 'MediumDust'
  71.     polvillo.YGravity = 200
  72.     polvillo.Friction = 0.2
  73.     polvillo.PPS = 200
  74.     polvillo.DeathTime = Bladex.GetTime() + 2.0 / 60.0
  75.     polvillo.Velocity = (sparkdir[0] * 500, sparkdir[1] * 500, sparkdir[2] * 500)
  76.     polvillo.RandomVelocity = 40.0
  77.     polvillo.RandomVelocity_V = 1.0
  78.  
  79.  
  80. def ThrowWoodenSparks(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, wcx, wcy, wcz, wdx, wdy, wdz):
  81.     obj = Bladex.GetEntity(hitting_entity)
  82.     
  83.     try:
  84.         if obj and obj.Data.NoFXOnHit:
  85.             return None
  86.     except:
  87.         pass
  88.  
  89.     mod = B3DLib.Modulo(ximpulse, yimpulse, zimpulse)
  90.     if mod < 5000.0:
  91.         return None
  92.     
  93.     sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  94.     spark = Bladex.CreateSpark('Wood', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.75, 2000, 60, 0, 80, 75, 46, 21, 6, 3, 2, 900, 15.0 / 60.0, 1.0 / 60.0, 0)
  95.     spark.RasterMode = 'BlendingAlpha'
  96.     polvillo = Bladex.CreateEntity('PolvoGolpe', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  97.     polvillo.ParticleType = 'MediumDust'
  98.     polvillo.YGravity = 200
  99.     polvillo.Friction = 0.2
  100.     polvillo.PPS = 250
  101.     polvillo.DeathTime = Bladex.GetTime() + 2.0 / 60.0
  102.     polvillo.Velocity = (sparkdir[0] * 500, sparkdir[1] * 500, sparkdir[2] * 500)
  103.     polvillo.RandomVelocity = 40.0
  104.     polvillo.RandomVelocity_V = 1.0
  105.     on_hit_info = Reference.MaterialOnHitInfo['MaderaTablas']
  106.     sound = on_hit_info[0]
  107.     if sound:
  108.         sound.Stop()
  109.         sound.Play(xhit_point, yhit_point, zhit_point, 0)
  110.     
  111.  
  112.  
  113. def ThrowStoneSparks(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, wcx, wcy, wcz, wdx, wdy, wdz):
  114.     obj = Bladex.GetEntity(hitting_entity)
  115.     
  116.     try:
  117.         if obj and obj.Data.NoFXOnHit:
  118.             return None
  119.     except:
  120.         pass
  121.  
  122.     mod = B3DLib.Modulo(ximpulse, yimpulse, zimpulse)
  123.     if mod < 5000.0:
  124.         return None
  125.     
  126.     sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  127.     chispa = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  128.     polvillo = Bladex.CreateEntity('PolvoGolpe', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  129.     polvillo.ParticleType = 'MediumDust'
  130.     polvillo.YGravity = 200
  131.     polvillo.Friction = 0.2
  132.     polvillo.PPS = 200
  133.     polvillo.DeathTime = Bladex.GetTime() + 2.0 / 60.0
  134.     polvillo.Velocity = (sparkdir[0] * 500, sparkdir[1] * 500, sparkdir[2] * 500)
  135.     polvillo.RandomVelocity = 40.0
  136.     polvillo.RandomVelocity_V = 1.0
  137.     on_hit_info = Reference.MaterialOnHitInfo['Piedra']
  138.     sound = on_hit_info[0]
  139.     if sound:
  140.         sound.Stop()
  141.         sound.Play(xhit_point, yhit_point, zhit_point, 0)
  142.     
  143.  
  144.  
  145. def SetSparkling(obj_name):
  146.     obj = Bladex.GetEntity(obj_name)
  147.     if obj.HitFunc:
  148.         print 'Este objeto ya es rompible o chispeante.'
  149.         return None
  150.     
  151.     obj.Static = 0
  152.     obj.HitFunc = ThrowSparks
  153.     return obj
  154.  
  155.  
  156. def SetDustySparkling(obj_name):
  157.     obj = Bladex.GetEntity(obj_name)
  158.     if obj.HitFunc:
  159.         print 'Este objeto ya es rompible o chispeante.'
  160.         return None
  161.     
  162.     obj.Static = 0
  163.     obj.HitFunc = ThrowDustAndSparks
  164.     return obj
  165.  
  166.  
  167. def SetWoodenSparkling(obj_name):
  168.     obj = Bladex.GetEntity(obj_name)
  169.     if obj.HitFunc:
  170.         print 'Este objeto ya es chispeante.'
  171.         return None
  172.     
  173.     obj.Static = 0
  174.     obj.HitFunc = ThrowWoodenSparks
  175.     return obj
  176.  
  177.  
  178. def SetMetalSparkling(obj_name):
  179.     obj = Bladex.GetEntity(obj_name)
  180.     if obj.HitFunc:
  181.         print 'Este objeto ya es rompible o chispeante.'
  182.         return None
  183.     
  184.     obj.Static = 0
  185.     obj.HitFunc = ThrowMetalSparks
  186.     return obj
  187.  
  188.  
  189. def SetStoneSparkling(obj_name):
  190.     obj = Bladex.GetEntity(obj_name)
  191.     if obj.HitFunc:
  192.         print 'Este objeto ya es rompible o chispeante.'
  193.         return None
  194.     
  195.     obj.Static = 0
  196.     obj.HitFunc = ThrowStoneSparks
  197.     return obj
  198.  
  199. import pdb
  200.  
  201. def ThrowSparksShield(hit_entity, hitting_entity, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, DamageType):
  202.     hitting_ent = Bladex.GetEntity(hitting_entity)
  203.     hitting_ent.MessageEvent(Reference.MESSAGE_STOP_WEAPON, 0, 0)
  204.     skip_sparks = 0
  205.     
  206.     try:
  207.         if hitting_ent.Data.NoFXOnHit:
  208.             skip_sparks = 1
  209.     except:
  210.         pass
  211.  
  212.     if not skip_sparks:
  213.         sparkdir = B3DLib.Normalize((-ximpulse, -yimpulse, -zimpulse))
  214.         chispa = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  215.     
  216.     hit_ent = Bladex.GetEntity(hit_entity)
  217.     datos_esc = Reference.DefaultObjectData[hit_ent.Kind]
  218.     if datos_esc[0] == Reference.OBJ_SHIELD:
  219.         Reference.DefaultObjectData[hit_ent.Kind][3].Play(xhit_point, yhit_point, zhit_point, 0)
  220.     elif datos_esc[0] == Reference.OBJ_WEAPON:
  221.         if Reference.GiveWeaponFlag(hit_entity) != Reference.W_FLAG_1H:
  222.             Reference.DefaultObjectData[hit_ent.Kind][5][6].Play(xhit_point, yhit_point, zhit_point, 0)
  223.         
  224.     
  225.     VictimName = hit_ent.Parent
  226.     AttackerName = hitting_ent.Parent
  227.     pj = Bladex.GetEntity(VictimName)
  228.     if hitting_ent.Arrow and hitting_ent.Parent:
  229.         pdb.set_trace()
  230.     
  231.     pj.DamageFunc(VictimName, AttackerName, hitting_entity, DamageType, 0, -1, xhit_point, yhit_point, zhit_point, 1)
  232.     if netgame.GetNetState() == 1:
  233.         netgame.CallEventSound(hit_entity, 4)
  234.     
  235.     if hitting_ent.Arrow and not (hitting_ent.Parent):
  236.         hitting_ent.Stop()
  237.         impact = hitting_ent.GraspPos('Impact')
  238.         centre = hitting_ent.Position
  239.         impact2centre = (centre[0] - impact[0], centre[1] - impact[1], centre[2] - impact[2])
  240.         abs_pos = (xhit_point + impact2centre[0], yhit_point + impact2centre[1], zhit_point + impact2centre[2])
  241.         rel_pos = hit_ent.Abs2RelPoint(abs_pos[0], abs_pos[1], abs_pos[2])
  242.         hitting_ent.Position = (rel_pos[0] * 0.8, rel_pos[1], rel_pos[2] * 0.8)
  243.         hit_ent.Link(hitting_ent)
  244.         sticktime = 1.0 / hitting_ent.Mass
  245.         Bladex.AddScheduledFunc(Bladex.GetTime() + sticktime, Damage.StuckWeaponFall, (hitting_ent.Name, hit_ent.Name), hitting_ent.Name + '_StuckWeaponFall')
  246.         if hitting_ent.StickFunc:
  247.             hitting_ent.StickFunc(hitting_entity, hit_entity)
  248.         
  249.     
  250.  
  251.  
  252. def SetShieldArea(obj_name, cone, height, radius):
  253.     esc = Bladex.GetEntity(obj_name)
  254.     if not (esc.Weapon):
  255.         esc.Static = 1
  256.     
  257.     esc.Weapon = 1
  258.     esc.Cone = cone
  259.     esc.Height = height
  260.     esc.Radius = radius
  261.     esc.HitShieldFunc = ThrowSparksShield
  262.     return esc
  263.  
  264.  
  265. def MakeShield(obj_name):
  266.     esc = Bladex.GetEntity(obj_name)
  267.     if not (esc.Weapon):
  268.         esc.Static = 1
  269.     
  270.     esc.Weapon = 1
  271.     datos_esc = Reference.DefaultObjectData[esc.Kind]
  272.     if datos_esc[0] == Reference.OBJ_SHIELD:
  273.         esc.Cone = datos_esc[4]
  274.         esc.Height = datos_esc[5]
  275.         esc.Radius = datos_esc[6]
  276.         if datos_esc[7]:
  277.             Breakings.SetBreakableWS(obj_name)
  278.         
  279.     else:
  280.         esc.Cone = 3.1416
  281.         esc.Height = 2000
  282.         esc.Radius = 750
  283.         if datos_esc[0] == Reference.OBJ_STANDARD or datos_esc[0] == Reference.OBJ_WEAPON:
  284.             if Reference.GiveWeaponFlag(obj_name) != Reference.W_FLAG_1H:
  285.                 esc.Cone = datos_esc[5][1]
  286.                 esc.Height = datos_esc[5][2]
  287.                 esc.Radius = datos_esc[5][3]
  288.                 if datos_esc[5][5]:
  289.                     Breakings.SetBreakableWS(obj_name)
  290.                 
  291.             else:
  292.                 print 'MakeShield. Unexpected weapon FLAG'
  293.         else:
  294.             print 'MakeShield. Unexpected type of object'
  295.     esc.HitShieldFunc = ThrowSparksShield
  296.     return esc
  297.  
  298. stones_active = 0
  299. max_stones_active = 4
  300.  
  301. def RemoveStone(obj_name):
  302.     global stones_active
  303.     Piedra = Bladex.GetEntity(obj_name)
  304.     if Piedra:
  305.         Piedra.SubscribeToList('Pin')
  306.         stones_active = stones_active - 1
  307.     
  308.  
  309.  
  310. def DropStone(x, y, z, dx = 1, dy = 1, dz = 1, Pname = 'Piedra_01'):
  311.     global stones_active
  312.     if stones_active < max_stones_active:
  313.         Piedra = Bladex.CreateEntity('Piedrita', Pname, x, y, z, 'Physic')
  314.         Piedra.Scale = 0.075 + whrandom.random() * 0.13
  315.         mod = B3DLib.Modulo(dx, dy, dz)
  316.         dx = dx / mod + whrandom.random() * 0.4 - whrandom.random() * 0.4
  317.         dy = dy / mod + whrandom.random() * 0.4 - whrandom.random() * 0.4
  318.         dz = dz / mod + whrandom.random() * 0.4 - whrandom.random() * 0.4
  319.         (dx, dy, dz) = B3DLib.Scale((dx, dy, dz), mod)
  320.         Piedra.ExclusionGroup = 1
  321.         Piedra.ImpulseC(x + (whrandom.random() * 200.0 - 100.0), y + whrandom.random() * -100.0, z + (whrandom.random() * 200.0 - 100.0), dx, dy, dz)
  322.         Piedra.OnStopFunc = RemoveStone
  323.         stones_active = stones_active + 1
  324.         return Piedra
  325.     else:
  326.         return None
  327.  
  328.  
  329. def SectorThrowSparks(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material):
  330.     D = B3DLib.Normalize((ximpulse, yimpulse, zimpulse))
  331.     TWO_NdotD = 2.0 * (D[0] * x_norm + D[1] * y_norm + D[2] * z_norm)
  332.     sparkdir = (D[0] - x_norm * TWO_NdotD, D[1] - y_norm * TWO_NdotD, D[2] - z_norm * TWO_NdotD)
  333.     spark = Bladex.CreateSpark('Chispa', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.5, 3000, 2000, 0, 100, 160, 120, 40, 30, 24, 0, 800, 10.0 / 60.0, 1.0 / 60.0, 1)
  334.     polvillo = Bladex.CreateEntity('PolvoGolpe', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  335.     polvillo.ParticleType = 'MediumDust'
  336.     polvillo.YGravity = 200
  337.     polvillo.Friction = 0.2
  338.     polvillo.PPS = 200
  339.     polvillo.DeathTime = Bladex.GetTime() + 2.0 / 60.0
  340.     polvillo.Velocity = (sparkdir[0] * 500, sparkdir[1] * 500, sparkdir[2] * 500)
  341.     polvillo.RandomVelocity = 40.0
  342.     polvillo.RandomVelocity_V = 1.0
  343.     nstones = whrandom.randint(0, max_stones_active)
  344.     stone_startx = xhit_point + x_norm * 200.0
  345.     stone_starty = yhit_point + y_norm * 200.0
  346.     stone_startz = zhit_point + z_norm * 200.0
  347.     stone_impx = x_norm * 2000
  348.     stone_impy = y_norm * 2000
  349.     stone_impz = z_norm * 2000
  350.     for i in range(nstones):
  351.         DropStone(stone_startx, stone_starty, stone_startz, stone_impx, stone_impy, stone_impz)
  352.     
  353.  
  354.  
  355. def SectorThrowSnow(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material):
  356.     D = B3DLib.Normalize((ximpulse, yimpulse, zimpulse))
  357.     TWO_NdotD = 2.0 * (D[0] * x_norm + D[1] * y_norm + D[2] * z_norm)
  358.     sparkdir = (D[0] - x_norm * TWO_NdotD, D[1] - y_norm * TWO_NdotD, D[2] - z_norm * TWO_NdotD)
  359.     spark = Bladex.CreateSpark('Snow', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.8, 400, 100, 10, 20, 200, 200, 200, 56, 56, 56, 600, 90.0 / 60.0, 1.0 / 60.0, 0)
  360.     spark.RasterMode = 'BlendingAlpha'
  361.     tierra1 = Bladex.CreateEntity('SnowDust', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  362.     tierra1.ParticleType = 'SnowDust'
  363.     tierra1.YGravity = 200.0
  364.     tierra1.Friction = 0.15
  365.     tierra1.PPS = 200
  366.     tierra1.Time2Live = 64
  367.     tierra1.Velocity = (sparkdir[0] * 2000.0, sparkdir[1] * 2000.0, sparkdir[2] * 2000.0)
  368.     tierra1.RandomVelocity = 10.0
  369.     tierra1.DeathTime = Bladex.GetTime() + 0.05
  370.  
  371.  
  372. def SectorThrowWood(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material):
  373.     D = B3DLib.Normalize((ximpulse, yimpulse, zimpulse))
  374.     TWO_NdotD = 2.0 * (D[0] * x_norm + D[1] * y_norm + D[2] * z_norm)
  375.     sparkdir = (D[0] - x_norm * TWO_NdotD, D[1] - y_norm * TWO_NdotD, D[2] - z_norm * TWO_NdotD)
  376.     spark = Bladex.CreateSpark('Wood', xhit_point, yhit_point, zhit_point, sparkdir[0], sparkdir[1], sparkdir[2], 0.75, 2000, 60, 0, 80, 75, 46, 21, 6, 3, 2, 900, 15.0 / 60.0, 1.0 / 60.0, 0)
  377.     spark.RasterMode = 'BlendingAlpha'
  378.     polvillo = Bladex.CreateEntity('PolvoGolpe', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  379.     polvillo.ParticleType = 'MediumDust'
  380.     polvillo.YGravity = 200
  381.     polvillo.Friction = 0.2
  382.     polvillo.PPS = 250
  383.     polvillo.DeathTime = Bladex.GetTime() + 2.0 / 60.0
  384.     polvillo.Velocity = (sparkdir[0] * 500, sparkdir[1] * 500, sparkdir[2] * 500)
  385.     polvillo.RandomVelocity = 40.0
  386.     polvillo.RandomVelocity_V = 1.0
  387.  
  388.  
  389. def SectorThrowWater(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material):
  390.     D = B3DLib.Normalize((ximpulse, yimpulse, zimpulse))
  391.     TWO_NdotD = 2.0 * (D[0] * x_norm + D[1] * y_norm + D[2] * z_norm)
  392.     reflectdir = (D[0] - x_norm * TWO_NdotD, D[1] - y_norm * TWO_NdotD, D[2] - z_norm * TWO_NdotD)
  393.     Aguita1 = Bladex.CreateEntity('Cristales', 'Entity Particle System D1', xhit_point, yhit_point, zhit_point)
  394.     Aguita1.ParticleType = 'Splash'
  395.     Aguita1.PPS = 1024
  396.     Aguita1.YGravity = 2500.0
  397.     Aguita1.Friction = 0
  398.     Aguita1.Velocity = (reflectdir[0] * 2500.0, reflectdir[1] * 2500.0, reflectdir[2] * 2500.0)
  399.     Aguita1.RandomVelocity = 15.0
  400.     Aguita1.Time2Live = 32
  401.     Aguita1.DeathTime = Bladex.GetTime() + 0.1
  402.     Aguita1.Reflects = 0
  403.     Aguita2 = Bladex.CreateEntity('Cristales', 'Entity Particle System Dobj', 0, 0, 0)
  404.     Aguita2.ObjectName = entity_name
  405.     Aguita2.ParticleType = 'Splash'
  406.     Aguita2.PPS = 1024
  407.     Aguita2.YGravity = 4500.0
  408.     Aguita2.Friction = 0.1
  409.     Aguita2.RandomVelocity = 13.0
  410.     Aguita2.Time2Live = 64
  411.     Aguita2.DeathTime = Bladex.GetTime() + 0.2
  412.     Aguita2.Reflects = 0
  413.  
  414.  
  415. def GenericSectorOnHit(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material):
  416.     
  417.     try:
  418.         obj = Bladex.GetEntity(entity_name)
  419.         if obj.Data.NoFXOnHit:
  420.             return None
  421.     except:
  422.         pass
  423.  
  424.     if Reference.MaterialOnHitInfo.has_key(material):
  425.         on_hit_info = Reference.MaterialOnHitInfo[material]
  426.     else:
  427.         on_hit_info = Reference.MaterialOnHitInfo['default']
  428.     sound = on_hit_info[0]
  429.     func = on_hit_info[1]
  430.     if sound:
  431.         sound.Stop()
  432.         sound.Play(xhit_point, yhit_point, zhit_point, 0)
  433.     
  434.     if func:
  435.         func(sector_index, entity_name, xhit_point, yhit_point, zhit_point, ximpulse, yimpulse, zimpulse, x_norm, y_norm, z_norm, material)
  436.     
  437.  
  438.  
  439. def SetSectorOnHitFuncs():
  440.     GolpeGrava = Bladex.CreateSound('..\\..\\sounds\\golpe_grava.wav', 'GolpeGrava')
  441.     GolpeGrava.SetPitchVar(1, -8000, 8000, 0, 0)
  442.     GolpeNieve = Bladex.CreateSound('..\\..\\sounds\\golpe-nieve.wav', 'GolpeNieve')
  443.     GolpeNieve.SetPitchVar(1, -8000, 8000, 0, 0)
  444.     GolpeTierra = Bladex.CreateSound('..\\..\\sounds\\golpe_hierba.wav', 'GolpeTierra')
  445.     GolpeTierra.SetPitchVar(1, -8000, 8000, 0, 0)
  446.     GolpeAgua = Bladex.CreateSound('..\\..\\sounds\\golpe_agua.wav', 'GolpeAgua')
  447.     GolpeAgua.SetPitchVar(1, -8000, 8000, 0, 0)
  448.     GolpeHierba = Bladex.CreateSound('..\\..\\sounds\\golpe_hierba2.wav', 'GolpeHierba')
  449.     GolpeHierba.SetPitchVar(1, -8000, 8000, 0, 0)
  450.     GolpeMaderaTablas = Bladex.CreateSound('..\\..\\sounds\\golpe_maderamed.wav', 'GolpeMaderaTablas')
  451.     GolpeMaderaTablas.SetPitchVar(1, -8000, 8000, 0, 0)
  452.     GolpeMaderaTablas = Bladex.CreateSound('..\\..\\sounds\\golpe_maderamed.wav', 'GolpeMaderaTablas')
  453.     GolpeMaderaTablas.SetPitchVar(1, -8000, 8000, 0, 0)
  454.     GolpeMadera = Bladex.CreateSound('..\\..\\sounds\\M-GOLPESHEAVY4.wav', 'GolpeMadera')
  455.     GolpeMadera.SetPitchVar(1, -8000, 8000, 0, 0)
  456.     GolpeMetal = Bladex.CreateSound('..\\..\\sounds\\GOLPE-ARMADUR-1.wav', 'GolpeMetal')
  457.     GolpeMetal.SetPitchVar(1, -8000, 8000, 0, 0)
  458.     GolpeCristal = Bladex.CreateSound('..\\..\\sounds\\golpe-cristal-4.wav', 'GolpeCristal')
  459.     GolpeCristal.SetPitchVar(1, -8000, 8000, 0, 0)
  460.     Reference.MaterialOnHitInfo['default'] = [
  461.         GolpeGrava,
  462.         SectorThrowSparks]
  463.     Reference.MaterialOnHitInfo['Grava'] = [
  464.         GolpeGrava,
  465.         SectorThrowSparks]
  466.     Reference.MaterialOnHitInfo['Piedra'] = [
  467.         GolpeGrava,
  468.         SectorThrowSparks]
  469.     Reference.MaterialOnHitInfo['Nieve'] = [
  470.         GolpeNieve,
  471.         SectorThrowSnow]
  472.     Reference.MaterialOnHitInfo['Hierba'] = [
  473.         GolpeHierba,
  474.         None]
  475.     Reference.MaterialOnHitInfo['Tierra'] = [
  476.         GolpeTierra,
  477.         None]
  478.     Reference.MaterialOnHitInfo['Madera'] = [
  479.         GolpeMadera,
  480.         SectorThrowWood]
  481.     Reference.MaterialOnHitInfo['MaderaTablas'] = [
  482.         GolpeMaderaTablas,
  483.         SectorThrowWood]
  484.     Reference.MaterialOnHitInfo['Barro'] = [
  485.         None,
  486.         None]
  487.     Reference.MaterialOnHitInfo['Water'] = [
  488.         GolpeAgua,
  489.         SectorThrowWater]
  490.     Reference.MaterialOnHitInfo['Metal'] = [
  491.         GolpeMetal,
  492.         SectorThrowSparks]
  493.     Reference.MaterialOnHitInfo['Cristal'] = [
  494.         GolpeCristal,
  495.         None]
  496.     if netgame.GetNetState() == 0:
  497.         for i in range(Bladex.nSectors()):
  498.             sector = Bladex.GetSector(i)
  499.         
  500.     
  501.  
  502. SetSectorOnHitFuncs()
  503.